/**
 ----------------------
 1.当前文件是数据中心
 2.其他页面可以引入控制
 ----------------------
 */
import type {IQuery, TableConfig} from '@/api/config/types';
import type {SystemNotice} from '@/api/modules/system/notice/types';
import {noticeDelete, noticeEdit} from './curd';
import {DeleteOutlined, EditOutlined} from '@ant-design/icons-vue';
import {hasPerm} from '@/utils/common/perm';
import {useAxTable} from '@/utils/common/hooks';


//查询条件
let queryObj: Partial<IQuery<Partial<SystemNotice>>>= {
            noticeTitle: "" ,
            noticeType: "" ,
            status: "" ,
            orderByColumn: 'create_time',
            isAsc: 'desc',
};



export const noticeTable = useAxTable<SystemNotice>({
    //用于表格单选索引
    rowKey: 'noticeId',
    //必须唯一固定，存储窗口位置，表头等
    moduleName: 'SystemNotice',
    //搜索条件
    query: queryObj,
    //鼠标右键菜单数据
    contextmenu: [
        {
            title: '查看',
            label: '查看',
            key: 'list',
            onClick() {
                    noticeEdit();
            },
            icon: h(EditOutlined),
            disabled: hasPerm('ax:system:list'),
        },
        {
            title: '删除',
            label: '删除',
            key: 'delete',
            icon: h(DeleteOutlined),
            onClick() {
                    noticeDelete();
            },
            disabled: hasPerm('ax:system:remove'),
        },
    ],
});
